﻿/**
 * File: Filters\ErrorExceptionAttribute.cs.
 *
 * 异常过滤器
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace StackOverflow.WebApp.Filters
{
    public class ErrorExceptionAttribute:HandleErrorAttribute
    {

        public static Queue<Exception> QueueException = new Queue<Exception>();

        /**
         * Fn: public override void OnException(ExceptionContext filterContext)
         *
         * 在发生异常时调用，异常过滤器
         *
         * Author: bishisan
         *
         * Date: 2017/8/8
         *
         * Parameters:
         * filterContext -  操作筛选器上下文。.
         */

        public override void OnException(ExceptionContext filterContext)
        {
            base.OnException(filterContext);
            Exception Ex = filterContext.Exception;
            QueueException.Enqueue(Ex);
            filterContext.HttpContext.Response.Redirect("Error.html");
        }
    }
}